package com.xmall.product.define.request.attr;

import com.xmall.define.base.BaseUpdateRequest;
import com.xmall.validate.group.AddGroup;
import com.xmall.validate.group.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 请求数据格式：新增/编辑 product - attr
 */
@Data
public class SaleAttrUpdateRequest extends BaseUpdateRequest implements Serializable {

    /**
     * 分类ID
     */
    @NotNull(message = "分类ID不能为空", groups = { AddGroup.class })
    private Long categoryId;

    /**
     * 名称
     */
    @NotBlank(message = "名称不能为空", groups = { AddGroup.class, UpdateGroup.class })
    @Size(min = 2, max = 20, message = "名称长度必须在 2 到 20 之间", groups = { AddGroup.class, UpdateGroup.class })
    private String name;

    /**
     * 排序
     */
    @Null(message = "排序必须为空", groups = { AddGroup.class, UpdateGroup.class })
    private Integer sort;

    /**
     * 可选项列表
     */
    private List<String> optionList = new ArrayList<>();
}
